#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>

int main()
{
    umask(0);//设置掩码
    int fd  = open("myfile",O_WRONLY|O_CREAT,0644);
    if(fd<0)
    {
        perror("open failed");
        return 1;
    }
    int num = 5;
    const char* str = "i am yui\n";
    int len = strlen(str);
    while(num--)
    {
        write(fd,str,len);
    }
    close(fd);
    return 0;
}
